load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "testcat",
    testonly = 1,
    srcs = [
        "alter_table.go",
        "create_index.go",
        "create_sequence.go",
        "create_table.go",
        "create_view.go",
        "drop_index.go",
        "drop_table.go",
        "function.go",
        "set_zone_config.go",
        "table_expr.go",
        "test_catalog.go",
        "types.go",
        "vtable.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/opt/testutils/testcat",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config/zonepb",
        "//pkg/geo/geopb",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/settings/cluster",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/multiregion",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/catalog/tabledesc",
        "//pkg/sql/catalog/typedesc",
        "//pkg/sql/enum",
        "//pkg/sql/oidext",
        "//pkg/sql/opt/cat",
        "//pkg/sql/parser",
        "//pkg/sql/parser/statements",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/privilege",
        "//pkg/sql/roleoption",
        "//pkg/sql/rowenc",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/catid",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/tree/treecmp",
        "//pkg/sql/sem/volatility",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/sqlerrors",
        "//pkg/sql/stats",
        "//pkg/sql/syntheticprivilege",
        "//pkg/sql/types",
        "//pkg/sql/vtable",
        "//pkg/util/intsets",
        "//pkg/util/treeprinter",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_lib_pq//oid",
        "@in_gopkg_yaml_v2//:yaml_v2",
    ],
)

go_test(
    name = "testcat_test",
    size = "small",
    srcs = ["test_catalog_test.go"],
    data = glob(["testdata/**"]),
    deps = [
        ":testcat",
        "//pkg/sql/opt/testutils/opttester",
        "//pkg/testutils/datapathutils",
        "//pkg/util/leaktest",
        "@com_github_cockroachdb_datadriven//:datadriven",
    ],
)
